<?php
namespace application\controllers;

use system\core\Controller;
use system\libraries\FormValidation;

class Sessions extends Controller
{
    public function index()
    {
        //$this->session->setData('role', 'guest');

        $fv = new FormValidation();
        $fv->rules('input', 'Input', 'required');
        
        if ( $fv->run() )
        {
            if ( $_POST['btnFlash'] )
            {
                $this->session->setFlash('flash', $_POST['input']);
            }
            else if ( $_POST['btnSession'] )
            {
                $this->session->setData('data', $_POST['input']);
            }
            
            redirect('sessions');
        }
        
        $data['flash'] = $this->session->flash('flash');
        $data['data'] = $this->session->data('data');
        
        $this->session->setData('myData', 'myValue!!!');
        
        
        $this->load->vars($data);
    }
    
    public function destroy()
    {
        $this->template->disable();
        
        $this->session->destroy();
    }
}

/* End of file Sessions.php */
